package cn.lyq.card.data.api

import cn.lyq.card.data.model.*
import cn.lyq.card.global.Const
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.Header
import retrofit2.http.POST

interface HomeService {

    @POST("api/v1/index")
    suspend fun getHomeInfo(
        @Header("token") token: String = Const.token
    ): ResponseInfo<HomeInfo>

    @POST("api/v1/goods")
    suspend fun getGoods(
        @Header("token") token: String = Const.token
    ): ResponseInfo<MutableList<DeviceInfo>>

    @POST("api/v1/goodsDetails")
    @FormUrlEncoded
    suspend fun getGoodsDetails(
        @Field("goods_id") type: Int,
        @Header("token") token: String = Const.token
    ): ResponseInfo<DeviceInfo>

    @POST("api/v1/addGoodsOrder")
    @FormUrlEncoded
    suspend fun addGoodsOrder(
        @Field("goods_id") goodsId: Int,
        @Field("number") number: Int,
        @Field("paymentType") paymentType: Int,
        @Field("address_id") address_id: Int,
        @Field("remarks") remarks: String,
        @Header("token") token: String = Const.token
    ): ResponseInfo<OrderConfirmInfo>

    @POST("api/v1/orderDetails")
    @FormUrlEncoded
    suspend fun getOrderDetails(
        @Field("order_id") order_id: String,
        @Header("token") token: String = Const.token
    ): ResponseInfo<OrderDetailInfo>

    @POST("api/v1/paymentType")
    @FormUrlEncoded
    suspend fun updatePaymentType(
        @Field("order_id") order_id: String,
        @Field("paymentType") paymentType: Int,
        @Header("token") token: String = Const.token
    ): ResponseInfo<OrderConfirmInfo>

    @POST("api/v1/order")
    @FormUrlEncoded
    suspend fun getOrderList(
        @Field("page") page: Int,
        @Field("pagesize") pageSize: Int,
        @Header("token") token: String = Const.token
    ): ResponseInfo<MutableList<OrderDetailInfo>>

    @POST("api/v1/shareImage")
    suspend fun getShareImage(
        @Header("token") token: String = Const.token
    ): ResponseInfo<MutableList<ShareImageInfo>>

    @POST("api/v1/posCount")
    suspend fun posCount(
        @Header("token") token: String = Const.token
    ): ResponseInfo<PosCountInfo>

    @POST("api/v1/myPosCount")
    suspend fun myPosCount(
        @Header("token") token: String = Const.token
    ): ResponseInfo<MutableList<PosStatisticsInfo>>

    @POST("api/v1/teamPosCount")
    suspend fun teamPosCount(
        @Header("token") token: String = Const.token
    ): ResponseInfo<MutableList<PosStatisticsInfo>>

    /**
     * 获取机具激活详情
     * @param team 1.团队 0.我的
     * @param isAct 0未激活 1已激活
     * @param goodsId 机具id
     */
    @POST("api/v1/posList")
    @FormUrlEncoded
    suspend fun getDevProxy(
        @Field("team") team: Int,
        @Field("is_act") isAct: Int,
        @Field("goods_id") goodsId: Int,
        @Field("page") page: Int,
        @Field("pageSize") pageSize: Int,
        @Header("token") token: String = Const.token
    ): ResponseInfo<MutableList<DevActDetailInfo>>

    /**
     * 获取代理商机具激活详情
     * @param team 1.团队 0.我的
     * @param isAct 0未激活 1已激活
     * @param userId 对应代理商id（空为查询当前用户） 非必须
     */
    @POST("api/v1/posList")
    @FormUrlEncoded
    suspend fun getAgentDevDetail(
        @Field("team") team: Int,
        @Field("is_act") isAct: Int,
        @Field("user_id") userId: Int,
        @Field("page") page: Int,
        @Field("pageSize") pageSize: Int,
        @Header("token") token: String = Const.token
    ): ResponseInfo<MutableList<DevActDetailInfo>>
}